<!DOCTYPE html>
<html>
<head>
    <title>计算属性</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        姓名：<input type="text" name="name" v-model="name">
    </div>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                name: "陈奇"
            },
            // computed有缓存，页面上用了5次，实际只算了一次
            watch: {
                name(newValue, oldValue) {
                    console.log("新名字是", newValue, "老名字是", oldValue)
                }
            }
        })
    </script>
</body>
</html>